package com.foxzzz.osf;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;

public class FileTest {


    public static void main(String[] args) {
        try (RandomAccessFile raf = new RandomAccessFile("d:\\s.txt", "rw"); FileChannel channel = raf.getChannel();) {
            MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_WRITE, 1, 10);
            byte b = buffer.get(0);
            System.out.println(b);
            buffer.put("21312312312312312312".getBytes());
            buffer.force();
            buffer.clear();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
